<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script type="text/javascript">
	function addNew(id) {
		window.location = "${ctx }/category/create";
	}
</script>
<c:if test="${not empty message}">
	<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
</c:if>
<div class="row-fluid">
	<div class="span12">
		<h3>
			Category列表
			<span class="pull-right">
				<form id="searchForm" class="form-search" action="#">
					<input type="hidden" id="pageIndex" name="pageIndex" value="1"> 
					name： <input type="text" name="filter_LIKES_name" class="input-medium" value="${param.filter_LIKES_name}">
					
					<input type="submit" class="btn" value="Search"> 
					<input type="button" class="btn" value="Add New" onclick="addNew()">
				</form>
			</span>
		</h3>
		<form name="listForm" id="listForm" method="post">
			<table class="table table-bordered table-hover">
				<thead>
					<tr>
				    <th>ID</th>
				    <th>分类编码</th>
				    <th>分类名称</th>
				    <th>PID</th>
						<th>&nbsp;</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.content }" var="o">
						<tr>
							<td>${o.id}</td>
							<td>${o.code}</td>
							<td>${o.name}</td>
							<td>${o.pid}</td>
							<td><a href="${ctx}/category/${o.id}">Show</a>
								&nbsp; <a href="${ctx}/category/update/${o.id}">Edit</a>
								&nbsp; <a href="${ctx}/category/delete/${o.id}">Delete</a>
								&nbsp;</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</form>
	</div>
</div>

<!-- Pagination -->
<div class="row-fluid">
    <div class="span12">
    	<tags:pagination page="${page}" paginationSize="5"/>
  	</div>
</div>
